package br.com.dican.newportal.factory;
import java.sql.Connection;
import javax.naming.InitialContext;
import javax.sql.DataSource;

public class ConectionFactory {
	
	public static Connection getConnection() throws Exception{
		InitialContext context = new InitialContext();
		DataSource ds = (DataSource)context.lookup("java:comp/env/jdbc/postgres");
		if ( ds == null )
			throw new Exception("ERRO: Data source not found!");
		return ds.getConnection();
	}
}